<template>
	<view class="content">
		<view class="con_nav">
			<u-navbar :border="false">
				<view class="nav_con" @click="cshow">
					<view>{{plantTitle}}</view>
					<view class="nav_icon">
						<u-icon name="arrow-right" color="#ffffff" size="24"></u-icon>
					</view>
				</view>
			</u-navbar>
		</view>
		<view class="devices">
			<view class="dev_snum">
				温度23℃ | 湿度 70%
			</view>
			<view class="dev_referral">
				<view class="ref_item" @click="navTo('/pages/maintain/repair/repair')">
					<view class="">
						<image class="maxiconSize" src="@/static/device/wxjinyong.png" mode=""></image>
					</view>
					<view class="item_tle">
						维保日历
					</view>
				</view>
				<view class="ref_item" @click="navTo('/pages/maintain/polling/index')">
					<view class="">
						<image class="maxiconSize" src="@/static/device/wxxianzhi.png" mode=""></image>
					</view>
					<view class="item_tle">
						巡检统计
					</view>
				</view>
				<view class="ref_item" @click="navTo('/pages/maintain/upkeep/index')">
					<view class="">
						<image class="maxiconSize" src="@/static/device/wxbaofei.png" mode=""></image>
					</view>
					<view class="item_tle">
						保养统计
					</view>
				</view>
				<view class="ref_item" @click="navTo('/pages/maintain/repair/index')">
					<view class="">
						<image class="maxiconSize" src="@/static/device/wxpaimai.png" mode=""></image>
					</view>
					<view class="item_tle">
						维修统计
					</view>
				</view>
				<view class="ref_line">

				</view>
				<view class="ref_item">
					<view class="">
						<image class="maxiconSize" src="@/static/device/wxduoyingyong.png" mode=""></image>
					</view>
					<view class="item_tle">
						更多
					</view>
				</view>
			</view>
			<view class="dev_status" @click="cshow">
				<view class="dev_use">
					<image class="maxiconSize" src="@/static/device/wxzhengchangshiyong.svg" mode=""></image> 当日任务完成情况
				</view>
				<view class="">
					>
				</view>
			</view>
		</view>
		<view class="dev_func">
			<view class="task_object">
				<view class="task_goal">
					<view class="goal_tle">
						任务目标
					</view>
					<view class="goal_day">
						<text class="today" style="">今日</text>
						<text>上月</text>
					</view>
				</view>
				<view class="task_pro">
					<view class="pro_gre">
						<bestjhh-movable-area max='50' min='20'></bestjhh-movable-area>
					</view>
					<view class="pro_num">
						<text>0</text>
						<text>50个</text>
					</view>
				</view>
				<view class="task_con">
					<view class="con_item">
						<image src="../../static/device/gwpeizhi-yunweipeizhi.png" mode=""></image>
						<view class="">
							巡检：50
						</view>
					</view>
					<view class="con_item">
						<image src="../../static/device/gwpeizhi-yunweipeizhi.png" mode=""></image>
						<view class="">
							保养：100
						</view>
					</view>
					<view class="con_item">
						<image src="../../static/device/gwpeizhi-yunweipeizhi.png" mode=""></image>
						<view class="">
							保养：100
						</view>
					</view>
				</view>
				<view class="task_rate">
					<view class="">
						任务转化率：50%
					</view>
					<view class="rate_m" style="">
						较上月
					</view>
					<image src="../../static/device/gwpeizhi-yunweipeizhi.png" mode=""></image>
				</view>
			</view>
		</view>
		<view class="statistics">
			<RadiusTitle oneTle="设备统计" twoTle="设备相关统计分析" background=""></RadiusTitle>

			<view class="repair_level">
				<view class="icon_item">
					<view class="">
						<image src="@/static/device/g-ningmeng.svg" mode=""></image>设备等级分布
					</view>
					<view class="">

					</view>
				</view>
				<view class="level_pro pro_item">
					<view class="plan_item" style="margin-bottom: 36rpx;">
						<view class="item_tle">
							A(关键)
						</view>
						<view class="item_per">
							82.0%
						</view>
						<view class="item_pro">
							<u-line-progress active-color="#259b24" :percent="70"></u-line-progress>
						</view>
						<view class="item_num">
							26
						</view>
					</view>
					<view class="plan_item" style="margin-bottom: 36rpx;">
						<view class="item_tle">
							B(重要)
						</view>
						<view class="item_per">
							82.0%
						</view>
						<view class="item_pro">
							<u-line-progress active-color="#ff9800" :percent="70"></u-line-progress>
						</view>
						<view class="item_num">
							26
						</view>
					</view>
					<view class="plan_item">
						<view class="item_tle">
							C(一般)
						</view>
						<view class="item_per">
							82.0%
						</view>
						<view class="item_pro">
							<u-line-progress active-color="#e51c23" :percent="70"></u-line-progress>
						</view>
						<view class="item_num">
							26
						</view>
					</view>
				</view>
			</view>
		</view>



		<view class="repair_type">
			<view class="icon_item">
				<view class="">
					<image src="@/static/device/g-ningmeng.svg" mode=""></image>设备使用状态
				</view>
				<view class="">

				</view>
			</view>
			<view class="charts-box">
				<qiun-data-charts type="column" canvasId="canvasColumn2" :opts="opts2" :chartData="chartData2" :ontouch="true"
				 :canvas2d="true" background="none" />
			</view>
		</view>
		<view class="repair_type">
			<view class="icon_item">
				<view class="">
					<image src="@/static/device/g-ningmeng.svg" mode=""></image>设备年龄分析
				</view>
				<view class="">

				</view>
			</view>
			<view class="charts-box">

				<qiun-data-charts type="column" canvasId="canvasColumn1" :opts="opts1" :chartData="chartData1" :ontouch="true"
				 :canvas2d="true" background="none" />
			</view>
		</view>
		<u-select value-name="value" cancel-color="#999999" confirm-color="#0581fd" label-name="label" v-model="show" :list="list"
		 @confirm="confirm"></u-select>
	</view>
</template>

<script>
	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
	import DevTitle from "@/components/dev-title/index.vue"
	import RadiusTitle from "@/components/radius-title/index.vue"
	export default {
		mixins: [MescrollMixin], // 使用mixin
		components: {
			DevTitle,
			RadiusTitle
		},
		data() {
			return {

				opts2: {
					"type": "ring",
					"canvasId": "",
					"canvas2d": false,
					"background": "none",
					"animation": true,
					"timing": "easeOut",
					"duration": 1000,
					"color": [
						"#1890FF",
						"#91CB74",
						"#FAC858",
						"#EE6666",
						"#73C0DE",
						"#3CA272",
						"#FC8452",
						"#9A60B4",
						"#ea7ccc"
					],
					"padding": [
						5,
						5,
						5,
						5
					],
					"rotate": false,
					"errorReload": true,
					"fontSize": 13,
					"fontColor": "#666666",
					"enableScroll": false,
					"touchMoveLimit": 60,
					"enableMarkLine": false,
					"dataLabel": true,
					"dataPointShape": true,
					"dataPointShapeType": "solid",
					"tapLegend": true,
					"legend": {
						"show": true,
						"position": "right",
						"float": "center",
						"padding": 5,
						"margin": 10,
						"backgroundColor": "rgba(0,0,0,0)",
						"borderColor": "rgba(0,0,0,0)",
						"borderWidth": 1,
						"fontSize": 13,
						"fontColor": "#666666",
						"lineHeight": 25,
						"hiddenColor": "#CECECE",
						"itemGap": 12
					},
					"title": {
						"name": "",
						"fontSize": 30,
						"color": "#666666",
						"offsetX": 0,
						"offsetY": 0
					},
					"subtitle": {
						"name": "",
						"fontSize": 25,
						"color": "#7cb5ec",
						"offsetX": 0,
						"offsetY": 0
					},
					"extra": {
						"ring": {
							"ringWidth": 40,
							"centerColor": "#FFFFFF",
							"activeOpacity": 0,
							"activeRadius": 0,
							"offsetAngle": 0,
							"customRadius": 0,
							"labelWidth": 15,
							"border": true,
							"borderWidth": 3,
							"borderColor": "#FFFFFF",
							"linearType": "none"
						},
						"tooltip": {
							"showBox": true,
							"showArrow": true,
							"showCategory": false,
							"borderWidth": 0,
							"borderRadius": 0,
							"borderColor": "#000000",
							"borderOpacity": 0.7,
							"bgColor": "#000000",
							"bgOpacity": 0.7,
							"gridType": "solid",
							"dashLength": 4,
							"gridColor": "#CCCCCC",
							"fontColor": "#FFFFFF",
							"splitLine": true,
							"horizentalLine": false,
							"xAxisLabel": false,
							"yAxisLabel": false,
							"labelBgColor": "#FFFFFF",
							"labelBgOpacity": 0.7,
							"labelFontColor": "#666666"
						}
					}
				},
				chartData2: {
					"series": [{
						"data": [{
								"name": "在用",
								"value": 50
							},
							{
								"name": "禁用",
								"value": 30
							},
							{
								"name": "出租",
								"value": 20
							},
							{
								"name": "报废",
								"value": 18
							},
							{
								"name": "其他",
								"value": 8
							}
						]
					}]
				},


				opts1: {
					"type": "column",
					"canvasId": "",
					"canvas2d": false,
					"background": "none",
					"animation": true,
					"timing": "easeOut",
					"duration": 1000,
					"color": [
						"#1890FF",
						"#91CB74",
						"#FAC858",
						"#EE6666",
						"#73C0DE",
						"#3CA272",
						"#FC8452",
						"#9A60B4",
						"#ea7ccc"
					],
					"padding": [
						15,
						15,
						0,
						5
					],
					"rotate": false,
					"errorReload": true,
					"fontSize": 13,
					"fontColor": "#666666",
					"enableScroll": false,
					"touchMoveLimit": 60,
					"enableMarkLine": false,
					"dataLabel": false,
					"dataPointShape": true,
					"dataPointShapeType": "solid",
					"tapLegend": true,
					"xAxis": {
						"disabled": false,
						"axisLine": true,
						"axisLineColor": "#CCCCCC",
						"calibration": false,
						"fontColor": "#666666",
						"fontSize": 13,
						"rotateLabel": false,
						"itemCount": 5,
						"boundaryGap": "center",
						"disableGrid": true,
						"gridColor": "#CCCCCC",
						"gridType": "solid",
						"dashLength": 4,
						"gridEval": 1,
						"scrollShow": false,
						"scrollAlign": "left",
						"scrollColor": "#A6A6A6",
						"scrollBackgroundColor": "#EFEBEF",
						"format": ""
					},
					"yAxis": {
						"disabled": false,
						"disableGrid": false,
						"splitNumber": 5,
						"gridType": "solid",
						"dashLength": 8,
						"gridColor": "#CCCCCC",
						"padding": 10,
						"showTitle": false,
						"data": []
					},
					"legend": {
						"show": false,
						"position": "bottom",
						"float": "center",
						"padding": 5,
						"margin": 5,
						"backgroundColor": "rgba(0,0,0,0)",
						"borderColor": "rgba(0,0,0,0)",
						"borderWidth": 0,
						"fontSize": 13,
						"fontColor": "#666666",
						"lineHeight": 11,
						"hiddenColor": "#CECECE",
						"itemGap": 10
					},
					"extra": {
						"column": {
							"type": "group",
							"width": 30,
							"seriesGap": 2,
							"categoryGap": 3,
							"barBorderCircle": false,
							"linearType": "none",
							"linearOpacity": 1,
							"colorStop": 0,
							"meterBorder": 1,
							"meterFillColor": "#FFFFFF",
							"activeBgColor": "#000000",
							"activeBgOpacity": 0.08,
							"meterBorde": 1
						},
						"tooltip": {
							"showBox": true,
							"showArrow": true,
							"showCategory": false,
							"borderWidth": 0,
							"borderRadius": 0,
							"borderColor": "#000000",
							"borderOpacity": 0.7,
							"bgColor": "#000000",
							"bgOpacity": 0.7,
							"gridType": "solid",
							"dashLength": 4,
							"gridColor": "#CCCCCC",
							"fontColor": "#FFFFFF",
							"splitLine": true,
							"horizentalLine": false,
							"xAxisLabel": false,
							"yAxisLabel": false,
							"labelBgColor": "#FFFFFF",
							"labelBgOpacity": 0.7,
							"labelFontColor": "#666666"
						},
						"markLine": {
							"type": "solid",
							"dashLength": 4,
							"data": []
						}
					}
				},
				chartData1: {
					"categories": [
						"1年之内",
						"1至3年",
						"3至5年",
						"5至10年",
						"10年以上"
					],
					"series": [{
						"name": "数据",
						"data": [
							35,
							36,
							31,
							33,
							13
						]
					}]
				},

				show: false,
				list: [{
						value: '1',
						label: '江'
					},
					{
						value: '2',
						label: '湖'
					}
				],
				downOption: {
					auto: false //是否在初始化后,自动执行downCallback; 默认true
				},
				plantTitle: '格物重庆超级工厂',
				background: '#0581fd'
			};
		},
		mounted() {},
		methods: {
			cshow() {
				console.log('001')
				this.show = true
			},

			confirm(e) {
				console.log(e)
			},
			/*下拉刷新的回调 */
			downCallback() {
				let that = this
				return
				//联网加载数据
				this.apis.materialsApi.maMaterialList({
					pageNum: 1,
					pageSize: 10,
					category: this.dictValue,
					materialName: this.materialName
				}).then(res => {
					this.materList = res.rows
					this.mescroll.endBySize(res.rows.length, res.total)
				}).catch(() => {
					//联网失败的回调,隐藏下拉刷新的状态
					this.mescroll.endErr();
				})
			},
			/*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
			upCallback(page) {
				//联网加载数据
				return
				this.apis.materialsApi.maMaterialList({
					pageNum: 1,
					pageSize: 10,
					category: this.dictValue,
					materialName: this.materialName
				}).then(res => {
					this.materList = this.materList.concat(res.rows);
					this.mescroll.endBySize(res.rows.length, res.total)

				}).catch(() => {
					//联网失败的回调,隐藏下拉刷新的状态
					this.mescroll.endErr();
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@mixin minIconSize {
		width: 40rpx;
		height: 40rpx;
	}

	@mixin maxIconSize {
		width: 60rpx;
		height: 60rpx;
	}

	/deep/ .u-navbar {
		background: $bodyColor !important;
		color: #FFFFFF !important;
	}

	/deep/ .u-back-wrap {

		padding: 0 30rpx 0 0 !important;
	}

	.content {
		/deep/ .u-iconfont {
			display: none !important;
		}

		background: #fafafa;
		position: relative;

		.con_nav {
			/deep/ .u-border-bottom:after {
				border: none;
			}
		}

		.nav_con {
			width: 100%;
			display: flex;
			align-items: center;

			/deep/ .u-iconfont {
				display: block !important;
			}

			.nav_icon {
				margin-left: 10rpx;
			}
		}

		.devices {
			z-index: 9;
			width: 100%;
			position: fixed;
			background-color: $bodyColor;
			box-sizing: border-box;
			padding: 0 30rpx;

			.dev_snum {
				font-size: 24rpx;
				color: #FFFFFF;
			}

			.dev_referral {
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 60rpx 0;

				.ref_item {
					color: #FFFFFF;
					display: flex;
					flex-direction: column;
					align-items: center;
					font-size: 32rpx;

					image {
						@include minIconSize;
						font-size: blod;
					}

					.item_tle {
						font-size: 24rpx;
						margin: 6rpx 0;
					}
				}

				.ref_line {
					height: 130rpx;
					width: 2rpx;
					background: rgba($color: #ffffff, $alpha: 0.8);
				}
			}

			.dev_status {
				width: 92%;
				position: fixed;
				margin-top: -35rpx;
				@include box_shadow;
				@include box_radius(80rpx) color: $maincolor;
				background: #ffffff;
				padding: 18rpx 30rpx;
				box-sizing: border-box;
				display: flex;
				align-items: center;
				justify-content: space-between;

				.dev_use {
					font-size: 28rpx;
					display: flex;
					align-items: center;

					image {
						@include minIconSize;
						margin-right: 20rpx;
					}
				}
			}
		}

		.dev_func {
			overflow: hidden;
			box-sizing: border-box;
			padding: 0 20rpx;
			padding-top: 370rpx;

			.task_object {
				display: flex;
				flex-direction: column;
				padding: 10rpx 44rpx 22rpx 44rpx;
				@include box_radius(24rpx) box-sizing: border-box;
				background: #FFFFFF;
				margin-bottom: 30rpx;

				.task_goal {
					display: flex;
					justify-content: space-between;
					align-items: center;

					.goal_tle {
						font-size: 28rpx;
						color: #638EE3;
						font-weight: bold;
					}

					.goal_day {
						font-size: 28rpx;

						.today {
							margin-right: 10rpx;
							color: #638EE3;
							position: relative;
						}

						.today::after {
							content: '';
							position: absolute;
							border: 4rpx solid transparent;
							border-top-color: #638EE3;
							width: 46rpx;
							top: 100%;
							left: 0%;
							// transform: translateX(-50%);
						}
					}
				}

				.task_rate {
					margin: 0 auto;
					display: flex;
					justify-content: space-between;
					align-items: center;
					font-size: 28rpx;
					color: #638EE3;

					image {
						width: 30rpx;
						height: 30rpx;
						// margin-right: 6rpx;
					}

					.rate_m {
						color: #A1A1A2;
						margin: 0 6rpx 0 10rpx;
					}
				}

				.task_pro {
					margin: 40rpx 0 50rpx 0;

					.pro_gre {}

					.pro_num {
						font-size: 28rpx;
						color: #101010;
						display: flex;
						justify-content: space-between;
						align-items: center;
					}
				}

				.task_con {
					display: flex;
					justify-content: space-between;
					margin-bottom: 40rpx;

					.con_item {
						display: flex;
						justify-content: space-between;
						align-items: center;
						font-size: 28rpx;
						color: #101010;

						image {
							width: 40rpx;
							height: 40rpx;
							margin-right: 6rpx;
						}
					}
				}
			}
		}

		.statistics {
			@include box_shadow;
			display: flex;
			flex-direction: column;
			z-index: -1;
			@include box_radius(24rpx);
			background: #FFFFFF;
			box-sizing: border-box;
			padding: 30rpx 20rpx 50rpx 20rpx;
			margin-bottom: 30rpx;

			.icon_item {
				color: #777777;
				font-size: 28rpx;
				display: flex;
				align-items: center;
				margin-bottom: 20rpx;
				justify-content: space-between;
				padding-right: 104rpx;

				image {
					@include minIconSize;
					margin-right: 20rpx;
				}

				view {
					display: flex;
					align-items: center;
				}

				view:nth-child(2) {
					image {
						width: 24rpx;
						height: 24rpx;
						margin-right: 8rpx;
					}
				}
			}

			.repair_level {
				background: #FFFFFF;
				padding: 54rpx 20rpx 20rpx 20rpx;
				box-sizing: border-box;
				border-radius: 24rpx;
				@include box_shadow;

				margin-bottom: 20rpx;

				.pro_item {
					display: flex;
					flex-direction: column;

					.plan_item {
						display: flex;
						justify-content: space-between;
						align-items: center;

						.item_pro {
							width: 346rpx;
							margin-right: 36rpx;
						}

						.item_tle {
							font-size: 28rpx;
							color: #101010;
							margin-right: 24rpx;
						}

						.item_per,
						.item_num {
							margin-right: 24rpx;
							font-size: 28rpx;
							color: #8C8C8C;
						}

						.item_num {
							margin-right: 0rpx;
						}
					}
				}
			}
		}

		.repair_type {
			background: #FFFFFF;
			padding: 54rpx 20rpx 20rpx 20rpx;
			box-sizing: border-box;
			border-radius: 24rpx;
			@include box_shadow;
			margin-bottom: 20rpx;

			/* 请根据需求修改图表容器尺寸，如果父容器没有高度图表则会显示异常 */
			.charts-box {
				width: 100%;
				height: 400rpx;
			}
		}

		.icon_item {
			color: #777777;
			font-size: 28rpx;
			display: flex;
			align-items: center;
			margin-bottom: 76rpx;
			justify-content: space-between;
			padding-right: 104rpx;

			image {
				@include minIconSize;
				margin-right: 20rpx;
			}

			view {
				display: flex;
				align-items: center;
			}

			view:nth-child(2) {
				image {
					width: 24rpx;
					height: 24rpx;
					margin-right: 8rpx;
				}
			}
		}
	}
</style>
